#!/usr/bin/env python
# coding: utf-8
import  sys
import  os
import codecs
import time
from task.taskItem import *
from task.tasklist import *
from  engine.common import *

print(getToday())
print(getYestoday())

#taskFile = sys.argv[1]
#taskCommonFile = sys.argv[2]

def findYestoday(ll):
    print(ll)
    if getYestoday() in ll[2]:
        return True

with open("./temp/curl.txt") as f:
    print('open this file')
    listText = f.read()
listText = eval(listText)
print(listText)


retValue=""
print(len(retValue))

for rectFocus in listText:
    if getYestoday() in rectFocus[1]:
        retValue = rectFocus


print(len(retValue))
print((retValue))


    #os.system(adbpath + currentHandsetSnumber + " shell am start -n  " + package + "/" + launch)
time.sleep(100)
def getIniFile(path):
    ret = 'null'
    file_list = os.listdir(path)
    for file in file_list:
        if '.ini' in file:
            ret = file
            break
    return ret
ret = getIniFile(".")
print((ret))

def is_Chinese(word):
    for ch in word:
        if '\u4e00' <= ch <= '\u9fff':
            return True
    return False
test="fslfsjf"
test="中午"
test="中午lf"

if is_Chinese(test):
    print("is alpha")
else:
    print("not is alpha")

# aTasklist = taskList(taskFile)



# for i in range(aTasklist.currentPos,aTasklist.totalTaskItem):
#     print(i+1)
#     print(aTasklist.itemList[i].taskItemName)
#     print("之前界面:"+aTasklist.itemList[i].currentScreen)
#     print("期待界面:"+aTasklist.itemList[i].exceptScreen)
#     print("事前计算:"+aTasklist.itemList[i].beforeCalcCommond)
#     print("事前结果:"+aTasklist.itemList[i].beforeCalcResult)
#     print("动作执行:"+aTasklist.itemList[i].actionCommand)
#     print("事后计算:"+aTasklist.itemList[i].afterCalcCommond)
#     print("事后结果:"+aTasklist.itemList[i].afterCalcResult)
#     print("出错状态转移码:"+aTasklist.itemList[i].errorStatusNo)
#test task run now
#
#
# for i in range(1,30):
#     if aTasklist !='':
#         print(aTasklist.currentPos)
#         if aTasklist.currentPos == aTasklist.totalTaskItem:
#             print("end of this task ")
#         else:
#             itemStatusRet,itemStatus = aTasklist.itemList[aTasklist.currentPos].itemStatusUpdate()
#             time.sleep(1)
#             if "done" in itemStatus:
#                 aTasklist.currentPos = aTasklist.currentPos+1
#                 if "None" not in itemStatusRet and itemStatusRet.isdigit():
#                     aTasklist.currentPos = int(itemStatusRet) -1
#             if aTasklist.currentPos == aTasklist.totalTaskItem:
#                 print("end of this task ")
#                 print("pls set the currentPos back 0,clear the task,mv it to runed task backup ")
#                 aTasklist=''
#     else:
#         print("there is no task ")
#         time.sleep(1)
#
#
